<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-btn+.layui-btn{
            margin-left: 0;
        }
        .layui-table td, .layui-table th
        {
            min-width: 50px !important;
        }
        .layui-table-cell{padding: 0 3px !important;}
        
        .layui-table td,.layui-table th,.layui-table tr,.layui-table,.layui-table thead,.layui-table tfoot,.layui-table-header,.layui-table-total{border-color:#000 !important}
        
        
        .layui-btn-xs {height: 22px !important;line-height: 22px !important;padding: 0 5px !important;font-size: 12px;}
        /*table thead .layui-table-col-special:nth-child(2n){background-color:#ddebf7}
        table thead .layui-table-col-special:nth-child(2n-1){background:#fce4d6}*/
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+4){background-color:#ddebf7}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+10){background-color:#fce4d6}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+20){background-color:#ddebf7}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(9){background-color:#F0E3AB}
        
        .layui-table-total  .layui-table tr td:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-total  .layui-table tr td:nth-child(n+4){background-color:#ddebf7}
        .layui-table-total  .layui-table tr td:nth-child(n+10){background-color:#fce4d6}
        .layui-table-total  .layui-table tr td:nth-child(n+20){background-color:#ddebf7}
        .layui-table-total  .layui-table tr td:nth-child(n+34){background-color:#F0E3AB}
        
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(3){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(4){background-color:#fce4d6}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(5){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(6){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(7){background-color:#ddebf7}
        
        
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+3){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+9){background-color:#fce4d6}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+22){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(8){background-color:#F0E3AB}
        
        .layui-btn-container{display:inline}
        .table-title{display:inline;font-size: 18px; margin-left: 30%;}
    </style>
  </head>
  
  <body> 
    <div class="x-body x-admin" style="padding:0 10px">
      <xblock style="">
        <div class="layui-card-body" style="padding-left: 0;float:left;padding-left:20px;padding-top:0;">
          <form class="layui-form layui-col-space5" action="" method="get">
            
          </form>
        </div>
      </xblock>
      <div class="layui-table-body layui-table-main" style="width: 100%;min-height:0;">
        <table class="layui-table layui-form" lay-filter="performance" id="performance"> </table>
      </div>
    </div>
    <script type="text/html" id="checkStatusHtml">
      {{ d.check_status == 1 ? '<span class="layui-badge layui-bg-green"><i class="layui-icon layui-icon-ok"></i></span>' : '<a title="核对" class="layui-btn layui-btn-primary layui-btn-xs " lay-filter="check" lay-submit="" lay-id="'+d.id+'" href="javascript:;"><i class="layui-icon">核对</i></a>' }}
    </script>
     <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
    <script type="text/html" id="barDemo">

    {{d.settle_status == 0 ?'<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="settle">结算</a>':'' }}

    {{d.settle_status == 1 ?'<a class="layui-btn-primary layui-border-green" lay-event="edit">已结算</a>':'' }}
    </script>
    <script type="text/html" id="toolbarDemo">
      <div class="table-title">
        <form class="layui-form" action="" style="display: inline;">
            <div class="layui-input-inline" style="width:90px">
                <select>
                    <option>2022</option>
                </select>
            </div>
            年
            <div class="layui-input-inline" style="width:65px">
                <select lay-filter="month">
                    <option value="02" {$month=='02'?'selected':''}>02</option>
                    <option value="03" {$month=='03'?'selected':''}>03</option>
                    <option value="04" {$month=='04'?'selected':''}>04</option>
                    <option value="05" {$month=='05'?'selected':''}>05</option>
                    <option value="06" {$month=='06'?'selected':''}>06</option>
                    <option value="07" {$month=='07'?'selected':''}>07</option>
                    <option value="08" {$month=='08'?'selected':''}>08</option>
                    <option value="09" {$month=='09'?'selected':''}>09</option>
                    <option value="10" {$month=='10'?'selected':''}>10</option>
                    <option value="11" {$month=='11'?'selected':''}>11</option>
                    <option value="12" {$month=='12'?'selected':''}>12</option>
                </select>
            </div>
            月赛事直播客户收益结算表
        </form>
      </div>
    </script>
    <script type="text/html" id="rank">
    {{d.LAY_TABLE_INDEX+1}}
    </script>
        
    <script>
      layui.use(['form','layer','jquery','table','util'], function(){
        form = layui.form,
        layer = layui.layer
        ,$ = layui.jquery
        ,table = layui.table
        ,util = layui.util;
        
        form.on('select(month)', function(data){
            window.location.href="?month="+data.value
        });
        
        table.render({
            elem: '#performance'
            ,height: $(window).height()-50
            ,url:'{:url('admin/performance/settleList')}?month={$month}'
            ,toolbar: '#toolbarDemo' 
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,limit: 500
            ,title: '赛事直播客户收益结算表'
            ,totalRow: true
            ,cols: [
                [
                {align: "center", title:'id', width: 50, sort: false, field:'live_id', fixed1: 'left', templet1: '#rank', totalRowText: '合计',rowspan:2 },
                
                {align: "center", title:'', colspan:2 ,style:"background-color:#ddebf7;",align:'right'},
                {align: "center", title:"后台收益" ,colspan:6 ,style:"background:#fce4d6"},
                {align: "center", title:"客户收益" ,colspan:10,style:"background:#ddebf7"},
                
                {align: "center", fixed1: 'right', width:70,title:"操作",  toolbar: '#barDemo',rowspan:2},
                {align: "center", title:"同步备注" ,width:170,rowspan:2,field:'settle_remark', fixed1: 'right',edit: 'text' },
                {align: "center", title:"审核结算备注" ,width:170,rowspan:2,field:'check_remark', fixed1: 'right',edit: 'text' },
                ],
                [
                {align: "center",field:'admin_name', fixed1: 'left', width:70, sort: false,title:"营销"},
                {align: "center",field:'title',  fixed1: 'left', width:200, title:"活动名称" ,unresize1:true},
                //{align: "center",field:'address', width:150,title:"活动地区"},
                {align: "center",field:'vote_date', width:80,title:"投票时间"},
                //{align: "center",field:'salesman_radio', width:90,title:"公司比例"},
                
                {align: "center",field:'total_income', width:80,title:"后台收益" ,totalRow: true},
                {align: "center",field:'refund_income', width:80,title:"投错票"},
                {align: "center",field:'reduce_income', width:80,title:"* * *",totalRow: true},
                
                {align: "center",field:'real_income', width:80,title:"实际收益",totalRow: true},

                {align: "center",field:'ratio', width:80,title:"分成比例"},
                {align: "center",field:'client_income', width:80,title:"客户收益",totalRow: true},
                {align: "center",field:'client_sxfee_radio', width:50,title:"点位"},
                {align: "center",field:'client_charges', width:60,title:"手续费",totalRow: true},
                {align: "center",field:'client_live_fee', width:60,title:"直播费"},
                {align: "center",field:'client_plive_fee', width:80,title:"照片直播"},
                {align: "center",field:'client_gift_fee', width:60,title:"礼品费",totalRow: true},
                {align: "center",field:'client_travel_fee', width:60,title:"差旅费"},
                {align: "center",field:'client_other_fee', width:60,title:"其它费用"},
                {align: "center",field:'client_other_income', width:80,title:"其它收益"},
                {align: "center",field:'client_final_income', width:80,title:"实际收益",totalRow: true},
                
              
            ]]
            ,page: false
        });

        table.on('edit(performance)', function(obj){
            var value = obj.value 
            ,data = obj.data 
            ,field = obj.field;
            console.log(obj);
            
        });

        table.on('tool(performance)', function(obj){
            var data = obj.data;
            if(obj.event == 'edit'){
                x_admin_show('转账详情','{:url('performance/report')}/?type=settle&id='+data.id,'','650','550')
            } else if(obj.event == 'settle'){
                //x_admin_show('查看详情','{:url('performance/report')}/?type=settle&id='+data.id,true)
                layer.confirm('是否确认结算？', {
                  btn: ['是','否'] //按钮
                }, function(){
                    $.get('{:url('performance/saveField')}?id='+data.id+'&field=settle_status&value=1',function(data){
                        layer.msg(data.msg);
                        $('.layui-table-main .laytable-cell-1-0-0').each(function(index,value){
                            if($(this).text() == obj.data.live_id){
                                $(this).parent().parent().find('.laytable-cell-1-0-4').html('<a class="layui-btn-primary layui-border-green" lay-event="edit">已结算</a>');
                                $(this).parent().parent().attr('style','border: #f00 solid 2px !important');
                            }
                        })
                    })
                }, function(){

                });
            }
        });

        table.on('edit(performance)', function(obj){
            var value = obj.value 
            ,data = obj.data 
            ,field = obj.field; 
            $.get('saveField?id='+data.id+'&field='+field+'&value='+util.escape(value),function(data){
                layer.msg(data.msg);
            })
            
            //layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改值为：'+ util.escape(value));
        });

        
      });

    </script>
  </body>

</html>